<%= render 'base' %>

<div class="toolbar">
  <form class="form-inline" action="<%= cpanel_sites_path %>">
    <div class="form-group">
      <input type="text" name="q" class="form-control" value="<%= params[:q] %>" placeholder="网站名称" />
    </div>
    <button class="btn btn-default">搜索</button>
  </form>
</div>

<div id="cpanel_sites">
  <table class="table table-bordered table-striped table-condensed">
    <tr class="head">
      <td style="width:40px;">编号</td>
      <td style="width:140px;">网站</td>
      <td>信息</td>
      <td>提交人</td>
      <td style="width:100px">节点</td>
      <td style="width:105px">时间</td>
      <td style="width:30px" class="opts"></td>
    </tr>
    <% @sites.each do |item| %>
    <tr class="<%= cycle("","even") %><%= ' deleted' if !item.deleted_at.blank? %>">
      <td><%= item.id %></td>
      <td><%= image_tag(item.favicon_url, style: "width:16px;height:16px;")%> <%= item.name %></td>
      <td>
        <%= link_to item.url,item.url, target: "_blank" %><br />
        <small class="muted"><%= item.desc %></small>
      </td>
      <td><%= user_name_tag(item.user) %></td>
      <td><%= item.site_node.name if !item.site_node.blank? %></td>
      <td><%= l(item.created_at, format: :short) %></td>
      <td>
        <%= link_to "", edit_cpanel_site_path(item.id), class: "fa fa-pencil" %>
        <%= link_to "", cpanel_site_path(item.id), method: :delete, 'data-confirm' => '确定要删除吗?', class: "fa fa-trash" %>
      </td>
    </tr>
    <% end %>
  </table>
  <%= will_paginate @sites %>
</div>

